package com.cyanite.playlv2api.http;

import com.cyanite.playlv2api.error.PlayLv2ApiCredentialsException;
import com.cyanite.playlv2api.error.PlayLv2ApiException;
import com.cyanite.playlv2api.error.PlayLv2ApiParseException;
import com.cyanite.playlv2api.parsers.json.Parser;
import com.cyanite.playlv2api.types.PlayLv2Type;

import org.apache.http.NameValuePair;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpRequestBase;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

public interface HttpApi {

    abstract public PlayLv2Type doHttpRequest(HttpRequestBase httpRequest,
            Parser<? extends PlayLv2Type> parser) throws PlayLv2ApiCredentialsException,
            PlayLv2ApiParseException, PlayLv2ApiException, IOException;

    abstract public String doHttpPost(String url, NameValuePair... nameValuePairs)
            throws PlayLv2ApiCredentialsException, PlayLv2ApiParseException, PlayLv2ApiException,
            IOException;

    abstract public HttpGet createHttpGet(String url, NameValuePair... nameValuePairs);

    abstract public HttpPost createHttpPost(String url, NameValuePair... nameValuePairs);

    abstract public HttpURLConnection createHttpURLConnectionPost(URL url)
            throws IOException;
}
